package com.leonardo.beanme.fields.impl;

import javax.microedition.lcdui.TextField;

import com.leonardo.beanme.fields.abs.TextInput;

public final class IntegerField extends TextInput {
	
	private static final int FIELD_CONSTRAINT = TextField.NUMERIC;
	
	public IntegerField() {
		super(FIELD_CONSTRAINT);
	}
		
	public Object getValue() {
		String value = ((TextField)super.getField()).getString();
		return invalidValue(value) ? new Integer(0) : Integer.valueOf(value);
	}
	
	public Object getDefaultValue() {
		return new Integer(0);
	}
	
}
